import pygame
import sys #退出程序时用到

pygame.init()#初始化pygame

size = width,height = 600,400
screen = pygame.display.set_mode(size)#窗口大小
pygame.display.set_caption('Hello!')#窗口标题

f = open('record.txt','w')

while True:
    for event in pygame.event.get():#事件队列循环
        f.write(str(event)+'\n')
        
        if event.type == pygame.QUIT:
            f.close()
            sys.exit()#系统退出
